home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-GM / Interfaces&Libraries / Interfaces / AIncludes / DeskBus.a < prev    next >
Encoding:
Text File  |  1998-02-17  |  5.0 KB  |  158 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        DeskBus.a
  3. ;
  4. ;    Contains:    Apple Desktop Bus (ADB) Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1987-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__DESKBUS__') = 'UNDEFINED' THEN
  19. __DESKBUS__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  25.     include 'MixedMode.a'
  26.     ENDIF
  27.  
  28.     IF TARGET_OS_MAC THEN
  29. ; typedef SInt8                         ADBAddress
  30.  
  31. ;    TempADBServiceRoutineUPP is needed because of circular definition of
  32. ;    ADBServiceRoutineProcPtr and ADBServiceRoutineUpp depending on each other.
  33. ;
  34.  
  35. ; typedef ProcPtr                         TempADBServiceRoutineUPP
  36.  
  37. ADBDataBlock            RECORD 0
  38. devType                     ds.b    1                ; offset: $0 (0)        ;  original handler ID 
  39. origADBAddr                 ds.b    1                ; offset: $1 (1)        ;  original ADB Address 
  40. dbServiceRtPtr             ds.l    1                ; offset: $2 (2)        ;  service routine pointer 
  41. dbDataAreaAddr             ds.l    1                ; offset: $6 (6)        ;  this field is passed as the refCon parameter to the service routine 
  42. sizeof                     EQU *                    ; size:   $A (10)
  43.                         ENDR
  44. ; typedef struct ADBDataBlock *            ADBDBlkPtr
  45.  
  46. ADBSetInfoBlock            RECORD 0
  47. siService                 ds.l    1                ; offset: $0 (0)        ;  service routine pointer 
  48. siDataAreaAddr             ds.l    1                ; offset: $4 (4)        ;  this field is passed as the refCon parameter to the service routine 
  49. sizeof                     EQU *                    ; size:   $8 (8)
  50.                         ENDR
  51. ; typedef struct ADBSetInfoBlock *        ADBSInfoPtr
  52.  
  53. ;  ADBOpBlock is only used when calling ADBOp from 68k assembly code 
  54. ADBOpBlock                RECORD 0
  55. dataBuffPtr                 ds.l    1                ; offset: $0 (0)        ;  buffer: pointer to variable length data buffer 
  56. opServiceRtPtr             ds.l    1                ; offset: $4 (4)        ;  completionProc: completion routine pointer 
  57. opDataAreaPtr             ds.l    1                ; offset: $8 (8)        ;  refCon: this field is passed as the refCon parameter to the completion routine 
  58. sizeof                     EQU *                    ; size:   $C (12)
  59.                         ENDR
  60. ; typedef struct ADBOpBlock *            ADBOpBPtr
  61.  
  62. ;
  63. ; pascal void ADBReInit(void )
  64. ;
  65.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  66.         _ADBReInit:    OPWORD    $A07B
  67.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  68.         IMPORT_CFM_FUNCTION ADBReInit
  69.     ENDIF
  70.  
  71. ;    ADBOp has a different interface for 68k assembly than for everything else
  72. ;    for 68k assembly the interface is 
  73. ;    #pragma parameter __D0 ADBOp(__A0,__D0)
  74. ;    OSErr ADBOp( ADBOpBlock * pb, short commandNum );
  75. ;
  76.  
  77. ;    IMPORTANT NOTE:
  78. ;    "Inside Macintosh: Devices" documents the completion routine for ADBOp will be called with
  79. ;    four parameters using 68k register based calling conventions, specifically the completion routine
  80. ;    passed in should be of type ADBServiceRoutineProcPtr. However, when upp types were first added
  81. ;    to this interface file, the type ADBCompletionUPP was mistakenly used for the second parameter
  82. ;    to ADBOp. Since applications have shipped using completion routines of type ADBCompletionUPP,
  83. ;    the mistake cannot be corrected.
  84. ;    The only difference between ADBServiceRoutineUPP and ADBCompletionUPP is the former takes an extra
  85. ;    argument which is a pointer to itself, fortunately not needed for PowerPC code.
  86. ;    For compatibility with existing 68k code, when an ADBOp completion routine is called,
  87. ;    68k register A1 will point to the completion routine, as documented in Inside Mac.
  88. ;
  89.  
  90. ;
  91. ; pascal OSErr ADBOp(Ptr refCon, ADBCompletionUPP compRout, Ptr buffer, short commandNum)
  92. ;
  93.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  94.         _ADBOp:    OPWORD    $A07C
  95.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  96.         IMPORT_CFM_FUNCTION ADBOp
  97.     ENDIF
  98.  
  99. ;
  100. ; pascal short CountADBs(void )
  101. ;
  102.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  103.         ; returns:
  104.         ;    short           <= D0
  105.         _CountADBs:    OPWORD    $A077
  106.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  107.         IMPORT_CFM_FUNCTION CountADBs
  108.     ENDIF
  109.  
  110. ;
  111. ; pascal ADBAddress GetIndADB(ADBDataBlock *info, short devTableIndex)
  112. ;
  113.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  114.         ; parameters:
  115.         ;    info            => A0
  116.         ;    devTableIndex   => D0
  117.         ; returns:
  118.         ;    ADBAddress      <= D0
  119.         _GetIndADB:    OPWORD    $A078
  120.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  121.         IMPORT_CFM_FUNCTION GetIndADB
  122.     ENDIF
  123.  
  124. ;
  125. ; pascal OSErr GetADBInfo(ADBDataBlock *info, ADBAddress adbAddr)
  126. ;
  127.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  128.         ; parameters:
  129.         ;    info            => A0
  130.         ;    adbAddr         => D0
  131.         ; returns:
  132.         ;    OSErr           <= D0
  133.         _GetADBInfo:    OPWORD    $A079
  134.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  135.         IMPORT_CFM_FUNCTION GetADBInfo
  136.     ENDIF
  137.  
  138. ;
  139. ; pascal OSErr SetADBInfo(const ADBSetInfoBlock *info, ADBAddress adbAddr)
  140. ;
  141.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  142.         ; parameters:
  143.         ;    info            => A0
  144.         ;    adbAddr         => D0
  145.         ; returns:
  146.         ;    OSErr           <= D0
  147.         _SetADBInfo:    OPWORD    $A07A
  148.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  149.         IMPORT_CFM_FUNCTION SetADBInfo
  150.     ENDIF
  151.  
  152.     ENDIF    ; TARGET_OS_MAC
  153.     ENDIF ; __DESKBUS__ 
  154.  
  155.